<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>

    <body>
        <script>
            function ajax (option) {
                // 1.创建xhr对象
                let XHR = new XMLHttpRequest()

                // 2.发送请求
                XHR.open(option.type, option.urls)

                // 3.传参
                XHR.send("name=wangfafa")

                // 4.等待后端返回数据
                XHR.onreadystatechange = function (code) {
                    // 1
                    // 2
                    // 3
                    // 后端返回数据
                    if (code === 4) {
                        // 处理数据
                    }
                }
            }
            ajax({
                url: 'http://bnm,bv',
                type: 'get',
                data: {

                },
                success: function (res) {

                }
            })

            $.ajax({
                url: '',
                type: '',
                data: {}
            }).then(res => {

            })
        </script>
    </body>

</html>